<?php

namespace Project\Admin\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Traits\Response;

class BaseController extends Controller
{
    use Response;

    protected $username = 'username';
    protected $guard;
    protected $auth;

    public function __construct()
    {
        // 所有请求都需要经过 refresh 中间件，除了 login、register 两个路由
        $this->middleware('admin.refresh', [
            'except' => [
                'login',
                'register',
                'reset',
                'icon'
            ]
        ]);
        $this->guard = config('admin.admin_guard');
        $this->username = config('admin.username', 'username');
        $this->auth = $this->guard();
    }

    public function guard()
    {
        return auth()->guard($this->guard);
    }
}
